#ifndef GAME_STATE_H
#define GAME_STATE_H

#include "State.h"
#include "Grid.h"
#include "Runway.h"
#include "DOF.h"

class GameState : public State
{
public:
	GameState(void);

	DECLARE_APPSTATE_CLASS(GameState);

	void enter(void);
	void createScene(void);
	void exit(void);

	bool keyReleased(const OIS::KeyEvent &evt);
	bool keyPressed(const OIS::KeyEvent &evt);

	bool mouseMoved(const OIS::MouseEvent &evt);
	bool mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id);
	bool mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id);

	void update(double timeSinceLastFrame);

private:
	void buildGUI(void);
	void moveCamera(void);
	void manageTerrain(Ogre::Light *light);
	void configureTerrainDefaults(Ogre::Light *light);
	void defineTerrain(long x, long y);
	void initBlendMaps(Ogre::Terrain *terrain);
	void itemSelected(OgreBites::SelectMenu* menu);

	Ogre::TerrainGlobalOptions *m_pTerrainGlobals;
	Ogre::TerrainGroup *m_pTerrainGroup;
	bool m_bIsImported;

	Ogre::RaySceneQuery *m_pRaySceneQuery;

	Ogre::Vector3 m_Translate;
	Ogre::Real m_MoveSpeed;
	Ogre::Degree m_RotateSpeed;
	float m_MoveScale;
	Ogre::Degree m_RotateScale;

	Runway *m_pSelectedObject;
	DOF::ID m_SelectedObjectID;

	OgreBites::ParamsPanel *m_pDetailsPanel;

	Helper::Grid *grid;

	bool m_bRMousePressed;
	bool m_bLMousePressed;

	bool m_bShowGrid;

	bool m_bExit;
};

#endif
